package org.example.chapter3.dao;
import org.example.chapter3.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class StudentDao {
    @Autowired
    JdbcTemplate jdbcTemplate;
    public Student getStudentByName(String sname){
        String sql = "select * from student where sname = ?";
        return jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<Student>(Student.class),sname);
    }

}
